<template>
  <div class="app-container">
    <el-descriptions title="用户信息" direction="vertical" :column="4" border>
      <el-descriptions-item label="手机号"><b>{{ userInfo.phone }}</b></el-descriptions-item>
      <el-descriptions-item label="用户姓名">{{ userInfo.name }}</el-descriptions-item>
      <el-descriptions-item label="状态">{{ userInfo.status == 0 ? '锁定' : '正常' }}</el-descriptions-item>
      <el-descriptions-item label="注册时间">{{ userInfo.createTime }}</el-descriptions-item>
    </el-descriptions>
    <br>
    <br>
    <br>
    <el-descriptions title="认证信息" direction="vertical" :column="4" border>
      <el-descriptions-item label="姓名"><b>{{ userInfo.name }}</b></el-descriptions-item>
      <el-descriptions-item label="证件类型">
        <el-tag size="small">{{ userInfo.certificatesType }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="证件号">{{ userInfo.certificatesNo }}</el-descriptions-item>
      <el-descriptions-item label="证件图片">
        <img :src="userInfo.certificatesUrl" width="80px" :alt="userInfo.name">
      </el-descriptions-item>
    </el-descriptions>
    <br>
    <br>
    <br>
    <h4>就诊人信息</h4>
    <el-table
      v-loading="listLoading"
      :data="patientList"
      stripe
      style="width: 100%">
      <el-table-column
        label="序号"
        width="70"
        align="center">
        <template slot-scope="scope">
          {{ scope.$index + 1 }}
        </template>
      </el-table-column>

      <el-table-column prop="name" label="姓名"/>
      <el-table-column prop="param.certificatesTypeString" label="证件类型"/>
      <el-table-column prop="certificatesNo" label="证件编号"/>
      <el-table-column label="性别">
        <template slot-scope="scope">
          {{ scope.row.sex == 1 ? '男' : '女' }}
        </template>
      </el-table-column>
      <el-table-column prop="birthdate" label="出生年月"/>
      <el-table-column prop="phone" label="手机"/>
      <el-table-column label="是否结婚">
        <template slot-scope="scope">
          {{ scope.row.isMarry == 1 ? '时' : '否' }}
        </template>
      </el-table-column>
      <el-table-column prop="fullAddress" label="地址"/>
      <el-table-column prop="createTime" label="注册时间"/>
    </el-table>
    <br>
    <el-row>
      <el-button  @click="back">返回</el-button>
    </el-row>
  </div>

</template>

<script>
import userInfo from '../../../api/userInfo'

export default {
  name: 'show',
  // 定义数据
  data() {
    return {
      id: this.$route.params.id,
      userInfo: {}, // 用户信息
      patientList: [], // 就诊人列表
      listLoading: true// 数据是否正在加载
    }
  },
  // 当页面加载时获取数据
  created() {
    this.showInfo()
  },
  methods: {
    // 根据id查询会员记录
    showInfo() {
      userInfo.show(this.id).then(response => {
        this.userInfo = response.data.userInfo;
        this.patientList = response.data.patientList;
        this.listLoading = false;
      })
    },
    back() {
      window.history.back(-1);
    }
  }

}
</script>

<style scoped>

</style>
